package com.blades.item;

/**
 * Created by shuangjun.yang on 2016/3/17.
 * 调用次数，执行时间监控项
 */
public class CountTimeMonitorItem {
    private Long countSize = new Long(0);
    private Double time = new Double(0);


    public CountTimeMonitorItem() {
    }
    public CountTimeMonitorItem(Long countSize, Double time) {
        this.countSize = countSize;
        this.time = time;
    }

    public synchronized void addCountAndTime(Long count,Double time){
        this.countSize += count;
        this.time += time;
    }

    public synchronized CountTimeMonitorItem getAndClear(){
        Long originalCount = this.countSize;
        Double originalTime = this.time;
        CountTimeMonitorItem countTimeMonitorItem = new CountTimeMonitorItem(originalCount,originalTime);
        this.countSize = 0L;
        this.time = 0D;
        return countTimeMonitorItem;
    }
    public Long getCountSize() {
        return countSize;
    }

    public void setCountSize(Long countSize) {
        this.countSize = countSize;
    }

    public Double getTime() {
        return time;
    }

    public void setTime(Double time) {
        this.time = time;
    }
}
